home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
User's Choice Windows CD
/
User's Choice Windows CD (CMS Software)(1993).iso
/
misc1
/
ami301c.zip
/
QKDUCTS.SM$
/
QKDUCTS.SMM
Wrap
INI File
|
1993-05-12
|
14KB
|
776 lines
[ver]
4
[sty]
_macro.sty
[files]
[charset]
82
ANSI (Windows, IBM CP 1252)
[revisions]
0
[prn]
QMS-PS 810
[port]
LPT1:
[lang]
1
[desc]
Calculates circular equivalent of rectangular ducts
737249399
16
733534631
492
5
0
0
0
0
1
[fopts]
0
1
0
0
[lnopts]
2
Body Text
1
[docopts]
5
2
[GramStyle]
[ParaNum]
1
[l1]
0
[pg]
5
44 0 64 0 0 1 0 65535 8 Standard 65535 0 0 0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
86 0 20 0 0 1 0 65535 65535 Standard 65535 0 0 0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
131 0 0 0 0 0 0 65535 65535 Standard 65535 0 0 0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
173 0 43 0 0 1 0 65535 65535 Standard 65535 0 0 0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
204 0 10 1025 0 0 0 65535 65535 Standard 65535 0 0 0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
[edoc]
<:#293,9360>Macro by <+!>Charlie Pappas<-!>
<:#284,9360>
<:#284,9360>Define EnableWindow() DllCall("user,EnableWindow,HHH", %1, %2)
<:#284,9360>Declare FontDlg(Action, Hdlg, id)
<:#284,9360>Declare CellEngine(Action)
<:#284,9360>
@Function@<:#293,9360>Function Main()
<:#284,9360>CellEngine(1) ' Start engine
<:#284,9360>FontDLG(1, 0, 0)
<:#284,9360>onerror endit
<:#284,9360>oncancel endit
<:#284,9360>rmac = getrunningmacrofile$()
<:#284,9360>setdlgcallback(0, "{rmac}!initdlg")
<:#284,9360>setdlgcallback(70, "{rmac}!winproc")
<:#284,9360>setdlgcallback(8000, "{rmac}!winproc")
<:#284,9360>setdlgcallback(8001, "{rmac}!winproc")
<:#284,9360>
<:#284,9360>dlgkeyinterrupt(<[>f1], "{rmac}!DisplayHelp")
<:#284,9360>dialogbox(".", "box1")
<:#284,9360>endit:
<:#284,9360>CellEngine(0)
<:#284,9360>FontDLG(4, 0, 0)
<:#284,9360>End Function
<:#284,9360>
@Function@<:#293,9360>function DisplayHelp()
@Outline2@<:#284,9360>' two defines needed for help. The help name and panel number are defined above
@Outline2@<:#284,9360>define FindWindowa() DllCall("user,FindWindow,HCC", %1, %2)
@Outline2@<:#568,9360>define WinHelpa(hWnd, file, cmd, ptr) DllCall("user,WinHelp,HHCHJ", %1, %2, %3, %4)
@Outline2@<:#284,9360>prohWnd = FindWindowa("AmiProWndA", 0)
@Outline2@<:#284,9360>helpfile = strcat$(GetAmiDirectory$(), "HelpPack.hlp")
@Outline2@PanelNum= 95
@Outline2@<:#284,9360>WinHelpa(prohWnd, helpfile, 0x0001, Panelnum)
@Outline2@<:#284,9360>end function
@Subhead@<:#284,9360>
@Function@<:#293,9360>function winproc(hdlg, id, value)
<:#284,9360>ignorekeyboard(1)
<:#284,9360>a = getdlgitemtext(hdlg, 8000)
<:#284,9360>b = getdlgitemtext(hdlg, 8001)
<:#284,9360>if isnumeric(a) and isnumeric(b) and a <<<;> 0
<:#284,9360> top = CellEngine("({a}*{b})^5")
<:#284,9360> bottom = CellEngine("({a}+{b})^2")
<:#284,9360> rad = CellEngine("({top}/{bottom})")
<:#284,9360> eighthroot = CellEngine("{rad}^(1/8)")
<:#284,9360> dc = <:f240,BArial,255,0,0>eighthroot * 1.3 ' multiply times 1.3
<:#284,9360> setdlgitemtext(hdlg, 1007, formatnum$("", "", 4, dc))
<:#284,9360> enablewindow(GetDlgItem(hdlg, 70), 1)
<:#284,9360>endif
<:#284,9360>if id = 70
<:#284,9360> clipboardwrite(<:f240,BArial,255,0,0>formatnum$("", "", 4, dc)<:f>, "Text") '
<:f240,BArial,255,0,0>format result to four places<:f>
<:#284,9360>endif
<:#284,9360>end function
<:#284,9360>
<:#284,9360>
@Function@<:#293,9360>function initdlg(hdlg, id, value)
<:#284,9360>for i = 1000 to 1005
<:#284,9360> fontdlg(3, hdlg, i)
<:#284,9360>next
<:#284,9360>fontdlg(3, hdlg, 8000)
<:#284,9360>fontdlg(3, hdlg, 8001)
<:#284,9360>enablewindow(GetDlgItem(hdlg, 70), 0)
<:#284,9360>end function
<:#284,9360>
@Subhead@<:#284,9360>
@Function@<:#293,9360>Function CellEngine(Action)
<:#284,9360>'Available Actions
<:#284,9360>' 1 Start the engine and allocate globalvar
<:#284,9360>' 2 Return the handle to the instance of the sheet
<:#284,9360>' 0 Shut everything down
<:#284,9360>' Default Expect a formula and return an answer
<:#284,9360>
<:#284,9360>' these defines may be useful at the beginning of your macro
<:#284,9360>Define StartEngine 1
<:#284,9360>Define GetInstance 2
<:#284,9360>Define CloseEngine 0
<:#284,9360>
<:#568,9360>Define CECREATEINSTANCE(LPHANDLE) DllCall("LTSCE01.DLL,CECREATEINSTANCE,HO",%1)
<:#568,9360>Define CEDESTROYINSTANCE(HANDLE) DllCall("LTSCE01.DLL,CEDESTROYINSTANCE,HH",%1)
<:#568,9360>Define CECALCNOW(HINSTANCE, lpFormula, lpOutPut) DllCall("LTSCE01.DLL,CECALCNOW,HHCC",%1,%2,%3)
<:#284,9360>
<:#284,9360>DefStr hInstance, Answer, Var;
<:#284,9360>Mac = GetRunningMacroFile$()
<:#284,9360>GlobalInstance = StrCat$(Mac,"hIstance")
<:#284,9360>
<:#284,9360>Switch Action
<:#284,9360> Case 1
<:#284,9360> ' start the engine
<:#284,9360> LibId = DLLLoadLib("LTSCE01.DLL","CECreateInstance","HO")
<:#284,9360> If LibId = 0
<:#284,9360> Message("<:f240,BArial,255,0,0>File LTSCE01.DLL<:f><:f240,BArial,255,0,0> is not found.<:f>", "<:f240,BArial,255,0,0>Ami Pro<:f>")
<:#284,9360> Return -1;
<:#284,9360> Endif
<:#284,9360> RetVal = CECREATEINSTANCE(&hInstance)
<:#284,9360> AllocGlobalVar("{GlobalInstance}",1)
<:#284,9360> AllocGlobalVar("{Mac}LibId",1)
<:#284,9360> SetGlobalVar("{Mac}Libid",LibId)
<:#284,9360> SetGlobalVar("{GlobalInstance}",hInstance)
<:#284,9360> Return hInstance;
<:#284,9360> Break;
<:#284,9360>
<:#284,9360> Case 2
<:#284,9360> ' return the handle to the instance of the sheet
<:#284,9360> AllocGlobalVar("{GlobalInstance}",1)
<:#284,9360> hInstance = GetGlobalVar$("{GlobalInstance}")
<:#284,9360> Return hInstance;
<:#284,9360> Break;
<:#284,9360>
<:#284,9360> Case 0
<:#284,9360> ' destroy the instance of the sheet and free the global var and libid
<:#284,9360> AllocGlobalVar("{GlobalInstance}",1)
<:#284,9360> AllocGlobalVar("{Mac}LibId",1)
<:#284,9360> hInstance = GetGlobalVar$("{GlobalInstance}")
<:#284,9360> LibId = GetGlobalVar$("{Mac}LibId")
<:#284,9360> If hInstance
<:#284,9360> CEDestroyInstance(hInstance)
<:#284,9360> DllFreeLib(Libid)
<:#284,9360> Endif
<:#284,9360> FreeGlobalVar("{GlobalInstance}")
<:#284,9360> FreeGlobalVar("{Mac}LibId")
<:#284,9360> Break;
<:#284,9360>
<:#284,9360> Default
<:#284,9360> ' Calculate the formula and return the answer
<:#284,9360> AllocGlobalVar("{GlobalInstance}",1)
<:#284,9360> hInstance = GetGlobalVar$("{GlobalInstance}")
<:#284,9360> CECalcNow(hInstance,"{Action}",&Answer)
<:#284,9360> Return Answer;
<:#284,9360> Break;
<:#284,9360>EndSwitch
<:#284,9360>End Function
<:#284,9360>
<:#284,9360>
@Function@<:#293,9360>Function FontDlg(Action, Hdlg, id)
<:#284,9360>' 1 Create a font and allocvar
<:#284,9360>' 2 Return the handle of the create font
<:#284,9360>' 3 Set the id specified to the font
<:#284,9360>' 4 Freeglobalvar and delete created object
<:#284,9360>
<:#852,9360>define CreateFontDLG() DllCall("gdi,CreateFont,HHHHHHHHHHHHHHC", %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14)
<:#284,9360>define DeleteObjectDLG(handle) DllCall("gdi,DeleteObject,HH", %1)
<:#568,9360>define SendMessageDLG(hwnd, msg, wpara, lparm) DllCall("user,SendMessage,HHHHJ", %1, %2, %3, %4)
<:#284,9360>
<:#284,9360>rmac = getrunningmacrofile$()
<:#284,9360>Switch Action
<:#284,9360> Case 1 ' Create the font and store it
<:#284,9360> Font = CreateFontDLG(13, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 32, "Helv")
<:#284,9360> AllocGlobalVar("{rmac}FontHandle",1)
<:#284,9360> If Font
<:#284,9360> SetGlobalVar("{rmac}FontHandle",Font)
<:#284,9360> Return Font
<:#284,9360> Else
<:#284,9360> Return 0; ' no font
<:#284,9360> Endif
<:#284,9360> Break;
<:#284,9360> Case 2 ' Return the handle to the font
<:#284,9360> Handle = GetGlobalVar$("{rmac}FontHandle")
<:#284,9360> If Handle
<:#284,9360> Return Handle
<:#284,9360> Else
<:#284,9360> Return 0
<:#284,9360> Endif
<:#284,9360>
<:#284,9360> Case 3 ' Set the id to the font
<:#284,9360> Handle = GetGlobalVar$("{rmac}FontHandle")
<:#284,9360> If Handle
<:#284,9360> IdControl = GetDlgITem(Hdlg, id)
<:#284,9360> SendMessageDlg(idControl, 0x30, Handle, 0)
<:#284,9360> Return 1
<:#284,9360> Else
<:#284,9360> Return 0
<:#284,9360> Endif
<:#284,9360> Break;
<:#284,9360>
<:#284,9360> Case 4 ' Delete the font and clear the var
<:#284,9360> Handle = GetGlobalVar$("{rmac}FontHandle")
<:#284,9360> If Handle
<:#284,9360> DeleteObjectDLG(Handle)
<:#284,9360> Stat = 1
<:#284,9360> Else
<:#284,9360> Stat = 0
<:#284,9360> Endif
<:#284,9360> FreeGlobalVar("{rmac}FontHandle")
<:#284,9360> Return Stat
<:#284,9360> Default
<:#284,9360> Message("Unable to create the dialog box font.", "<:f240,BArial,255,0,0>Ami Pro<:f>")
<:#284,9360>EndSwitch
<:#284,9360>
<:#284,9360>End Function
@Subhead@<:#284,9360>
@Subhead@<:#284,9360>
@Function@<:#293,9360>DIALOG box1
<:#568,9360><:f240,BArial,255,0,0>-2134376448 11 70 40 162 132 "" "AmiDialog" "Rectangular Ducts"
<:#284,9360><:f240,BArial,255,0,0>FONT 8 "Helv"
<:#568,9360><:f240,BArial,255,0,0>5 6 106 27 1003 1342177280 "static" "This computes the circular equivalent of a rectangular duct for equal friction and capacity." 0
<:#284,9360><:f240,BArial,255,0,0>5 34 83 26 1004 1342177290 "static" "qkducts.bmt" 0
<:#568,9360><:f240,BArial,255,0,0>5 79 72 10 1000 1342177280 "static" "Length of one side:" 0
<:#568,9360><:f240,BArial,255,0,0>5 93 72 10 1001 1342177280 "static" "Length of adjacent side:" 0
<:#284,9360><:f240,BArial,255,0,0>74 77 20 12 8000 1350631552 "edit" "" 0
<:#284,9360><:f240,BArial,255,0,0>74 91 20 12 8001 1350631552 "edit" "" 0
<:#568,9360><:f240,BArial,255,0,0>5 108 64 10 1002 1342177280 "static" "Circular equivalent = " 0
<:#284,9360><:f240,BArial,255,0,0>74 108 50 10 1007 1342177280 "static" "" 0
<:#284,9360><:f240,BArial,255,0,0>74 119 57 10 1005 1342177280 "static" "Diameter" 0
<:#284,9360><:f240,BArial,255,0,0>116 4 40 14 1 1342373889 "button" "Close" 0
<:#284,9360><:f240,BArial,255,0,0>116 20 40 14 70 1342373888 "button" "Copy" 0
<:#284,9360>END DIALOG
>
[Embedded]
00010456
>
[macsum] 7
Main 0 0 2 6
DisplayHelp 273 0 4 24
winproc 458 3 8 34
initdlg 962 3 2 53
CellEngine 1222 1 8 63
FontDlg 2105 3 6 131
box1 2991 0 -1 189
[macse]
14 Main
16 CellEngine 1
16 FontDLG 1 0 0
20 00000226
19 00000226
0 802
13
8 1
0 41 0 "{1}!initdlg"
0 41 70 "{1}!winproc"
0 41 8000 "{1}!winproc"
0 41 8001 "{1}!winproc"
0 47 112 "{1}!DisplayHelp"
0 26 "." "box1"
16 CellEngine 0
16 FontDLG 4 0 0
6 0
15
9
14 DisplayHelp
0 284 "user,FindWindow,HCC" "AmiProWndA" 0
13
8 1
0 798
13
0 16 [X] "HelpPack.hlp"
13
8 2
5 95
8 3
0 284 "user,WinHelp,HHCHJ" "{1}" "{2}" 1 "{3}"
6 0
15
9
14 winproc
0 32 1
0 42 "{0}" 8000
13
8 4
0 42 "{0}" 8001
13
8 5
0 277 "{4}"
13
0 277 "{5}"
13
6 4
5 0
18 1
1 1
1 1
11 00000418
16 CellEngine "({4}*{5})^5"
13
8 6
16 CellEngine "({4}+{5})^2"
13
8 7
16 CellEngine "({6}/{7})"
13
8 8
16 CellEngine "{8}^(1/8)"
13
8 9
6 9
5 1.3
4 0
8 10
0 19 "" "" 4 "{10}"
13
0 43 "{0}" 1007 [X]
0 44 "{0}" 70
13
0 284 "user,EnableWindow,HHH" [X] 1
6 1
5 70
18 0
11 00000492
0 19 "" "" 4 "{10}"
13
0 1038 [X] "Text"
6 3
15
9
14 initdlg
5 1000
8 4
5 1005
6 4
18 2
12 00000103
10 00000142
5 1
6 4
3 0
8 4
10 00000025
16 fontdlg 3 "{0}" "{4}"
10 00000070
16 fontdlg 3 "{0}" 8000
16 fontdlg 3 "{0}" 8001
0 44 "{0}" 70
13
0 284 "user,EnableWindow,HHH" [X] 0
6 3
15
9
14 CellEngine
0 802
13
8 5
0 16 "{5}" "hIstance"
13
8 6
5 1
6 0
18 0
11 00000405
0 297 "LTSCE01.DLL" "CECreateInstance" "HO"
13
8 7
6 7
5 0
18 0
11 00000236
0 3 "File LTSCE01.DLL is not found." "Ami Pro"
5 -1
15
9
0 284 "LTSCE01.DLL,CECREATEINSTANCE,HO" &2
13
8 8
0 271 "{6}" 1
0 271 "{5}LibId" 1
0 264 "{5}Libid" "{7}"
0 264 "{6}" "{2}"
6 2
15
9
10 00000871
10 00000871
5 2
6 0
18 0
11 00000509
0 271 "{6}" 1
0 265 "{6}"
13
8 2
6 2
15
9
10 00000871
10 00000871
5 0
6 0
18 0
11 00000758
0 271 "{6}" 1
0 271 "{5}LibId" 1
0 265 "{6}"
13
8 2
0 265 "{5}LibId"
13
8 7
6 2
11 00000701
0 284 "LTSCE01.DLL,CEDESTROYINSTANCE,HH" "{2}"
0 298 "{7}"
0 266 "{6}"
0 266 "{5}LibId"
10 00000871
10 00000871
0 271 "{6}" 1
0 265 "{6}"
13
8 2
0 284 "LTSCE01.DLL,CECALCNOW,HHCC" "{2}" "{0}" &3
6 3
15
9
10 00000871
6 1
15
9
14 FontDlg
0 802
13
8 4
5 1
6 0
18 0
11 00000277
0 284 "gdi,CreateFont,HHHHHHHHHHHHHHC" 13 0 0 0 400 0 0 0 0 0 0 0 0 "Helv"
13
8 5
0 271 "{4}FontHandle" 1
6 5
11 00000239
0 264 "{4}FontHandle" "{5}"
6 5
15
9
10 00000251
5 0
15
9
10 00000874
10 00000874
5 2
6 0
18 0
11 00000406
0 265 "{4}FontHandle"
13
8 6
6 6
11 00000381
6 6
15
9
10 00000393
5 0
15
9
10 00000874
5 3
6 0
18 0
11 00000624
0 265 "{4}FontHandle"
13
8 6
6 6
11 00000586
0 44 "{1}" "{2}"
13
8 7
0 284 "user,SendMessage,HHHHJ" "{7}" 48 "{6}" 0
5 1
15
9
10 00000598
5 0
15
9
10 00000874
10 00000874
5 4
6 0
18 0
11 00000819
0 265 "{4}FontHandle"
13
8 6
6 6
11 00000761
0 284 "gdi,DeleteObject,HH" "{6}"
5 1
8 8
10 00000771
5 0
8 8
0 266 "{4}FontHandle"
6 8
15
9
10 00000874
0 3 "Unable to create the dialog box font." "Ami Pro"
6 3
15
9
DIALOG box1
-2134376448 11 70 40 162 132 "" "AmiDialog" "Rectangular Ducts"
FONT 8 "Helv"
5 6 106 27 1003 1342177280 "static" "This computes the circular equivalent of a rectangular duct for equal friction and capacity." 0
5 34 83 26 1004 1342177290 "static" "qkducts.bmt" 0
5 79 72 10 1000 1342177280 "static" "Length of one side:" 0
5 93 72 10 1001 1342177280 "static" "Length of adjacent side:" 0
74 77 20 12 8000 1350631552 "edit" "" 0
74 91 20 12 8001 1350631552 "edit" "" 0
5 108 64 10 1002 1342177280 "static" "Circular equivalent = " 0
74 108 50 10 1007 1342177280 "static" "" 0
74 119 57 10 1005 1342177280 "static" "Diameter" 0
116 4 40 14 1 1342373889 "button" "Close" 0
116 20 40 14 70 1342373888 "button" "Copy" 0
00010481